from pydantic import BaseModel
from typing import Optional, List

class CdnConfigBase(BaseModel):
    userId: int
    domain: str
    originIp: str

class CdnConfigCreate(CdnConfigBase):
    nodeIds: Optional[List[int]] = []  # 新增：关联的节点 ID 列表
    cnameId: int
    pass

class CdnConfigUpdate(CdnConfigBase):
    userId: Optional[int] = None
    domain: Optional[str] = None
    originIp: Optional[str] = None
    nodeIds: Optional[List[int]] = []  # 新增：关联节点ID列表

class CdnConfig(CdnConfigBase):
    id: int

    class Config:
        orm_mode = True
